<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=2b866a6daac9014292432d81fe9b47e3"></script> 
<style>
</style>

<div style="width:100%;height:500px;border:1px solid gray" id="mapContainer"></div> 

<script type="text/javascript">  
    var map = new BMap.Map("mapContainer");  
    map.centerAndZoom(new BMap.Point(120.60867,31.305113), 17);  
    map.enableScrollWheelZoom();  
	<?php foreach ($positionInfos as $index=>$positionInfo) { ?>
	  var marker<?php echo $index; ?>=new BMap.Marker(new BMap.Point(<?php echo $positionInfo['lat']; ?>,<?php echo$positionInfo['lng']; ?>));  
	    map.addOverlay(marker<?php echo $index; ?>);  
	    var licontent<?php echo $index; ?>="</b><strong>起始地：</strong><input class=\"outset\" type=\"text\" name=\"origin\" value=\"<?php echo $sender_info['address']; ?>\"/><br>";  
	        licontent<?php echo $index; ?>+="<span><strong>地址：</strong><?php echo $positionInfo['name']; ?></span><br>";  
	        licontent<?php echo $index; ?>+="<span><strong>电话：</strong><?php echo $positionInfo['phone_num']; ?></span><br>";  
	        licontent<?php echo $index; ?>+="<span class=\"input\"><strong>目的地：</strong><b><?php echo $positionInfo['name']; ?><input class=\"outset-but\" type=\"button\" value=\"公交\" onclick=\"gotobaidu(1)\" /><input class=\"outset-but\" type=\"button\" value=\"驾车\"  onclick=\"gotobaidu(2)\"/><a class=\"gotob\" href=\"url=\"http://api.map.baidu.com/direction?destination=latlng:"+marker<?php echo $index; ?>.getPosition().lat+","+marker<?php echo $index; ?>.getPosition().lng+"|name:<?php echo $positionInfo['name']; ?>"+"®ion=苏州"+"&output=html\" target=\"_blank\"></a></span>";
	 
	    var hiddeninput<?php echo $index; ?>="<input type=\"hidden\" value=\""+'苏州'+"\" name=\"region\" /><input type=\"hidden\" value=\"html\" name=\"output\" /><input type=\"hidden\" value=\"driving\" name=\"mode\" /><input type=\"hidden\" value=\"latlng:"+marker<?php echo $index; ?>.getPosition().lat+","+marker<?php echo $index; ?>.getPosition().lng+"|name:<?php echo $positionInfo['name']; ?>"+"\" name=\"destination\" />";
	 
	    var content<?php echo $index; ?> ="<form id=\"gotobaiduform\" action=\"http://api.map.baidu.com/direction\" target=\"_blank\" method=\"get\">" + licontent<?php echo $index; ?> +hiddeninput<?php echo $index; ?>+"</form>";
	   
	    var opts<?php echo $index; ?> = { width: 300 };  
	       
	    var  infoWindow<?php echo $index; ?> = new BMap.InfoWindow(content<?php echo $index; ?>, opts<?php echo $index; ?>);  
	    marker<?php echo $index; ?>.openInfoWindow(infoWindow<?php echo $index; ?>);  
	    marker<?php echo $index; ?>.addEventListener('click',function(){
	        marker<?php echo $index; ?>.openInfoWindow(infoWindow<?php echo $index; ?>);
	    });  
	<?php }?>
	

    /*
    var marker=new BMap.Marker(new BMap.Point(120.60867,31.305113));  
    map.addOverlay(marker);  
    var licontent="<b>胥江社区</b><br>";  
        licontent+="<span><strong>地址：</strong>胥江社区</span><br>";  
        licontent+="<span><strong>电话：</strong>69332969</span><br>";  
        licontent+="<span class=\"input\"><strong></strong><input class=\"outset\" type=\"hidden\" name=\"origin\" value=\"江苏省苏州市吴中区枫津路159号\"/><input class=\"outset-but\" type=\"button\" value=\"公交\" onclick=\"gotobaidu(1)\" /><input class=\"outset-but\" type=\"button\" value=\"驾车\"  onclick=\"gotobaidu(2)\"/><a class=\"gotob\" href=\"url=\"http://api.map.baidu.com/direction?destination=latlng:"+marker.getPosition().lat+","+marker.getPosition().lng+"|name:胥江社区"+"®ion=苏州"+"&output=html\" target=\"_blank\"></a></span>";
 
    var hiddeninput="<input type=\"hidden\" value=\""+'苏州'+"\" name=\"region\" /><input type=\"hidden\" value=\"html\" name=\"output\" /><input type=\"hidden\" value=\"driving\" name=\"mode\" /><input type=\"hidden\" value=\"latlng:"+marker.getPosition().lat+","+marker.getPosition().lng+"|name:胥江社区"+"\" name=\"destination\" />";
 
    var content1 ="<form id=\"gotobaiduform\" action=\"http://api.map.baidu.com/direction\" target=\"_blank\" method=\"get\">" + licontent +hiddeninput+"</form>";
   
    var opts1 = { width: 300 };  
       
    var  infoWindow = new BMap.InfoWindow(content1, opts1);  
    marker.openInfoWindow(infoWindow);  
    marker.addEventListener('click',function(){
        marker.openInfoWindow(infoWindow);
    });  



    var marker2=new BMap.Marker(new BMap.Point(120.60866,31.306255));  
    map.addOverlay(marker2);  
    var licontent2="<b>三香社区</b><br>";  
        licontent2+="<span><strong>地址：</strong>三香社区</span><br>";  
        licontent2+="<span><strong>电话：</strong>69332965</span><br>";  
        licontent2+="<span class=\"input\"><strong></strong><input class=\"outset\" type=\"hidden\" name=\"origin\" value=\"江苏省苏州市吴中区枫津路159号\"/><input class=\"outset-but\" type=\"button\" value=\"公交\" onclick=\"gotobaidu(1)\" /><input class=\"outset-but\" type=\"button\" value=\"驾车\"  onclick=\"gotobaidu(2)\"/><a class=\"gotob\" href=\"url=\"http://api.map.baidu.com/direction?destination=latlng:"+marker2.getPosition().lat+","+marker2.getPosition().lng+"|name:三香社区"+"®ion=苏州"+"&output=html\" target=\"_blank\"></a></span>";
 
    var hiddeninput2="<input type=\"hidden\" value=\""+'苏州'+"\" name=\"region\" /><input type=\"hidden\" value=\"html\" name=\"output\" /><input type=\"hidden\" value=\"driving\" name=\"mode\" /><input type=\"hidden\" value=\"latlng:"+marker2.getPosition().lat+","+marker2.getPosition().lng+"|name:三香社区"+"\" name=\"destination\" />";
 
    var content2 ="<form id=\"gotobaiduform\" action=\"http://api.map.baidu.com/direction\" target=\"_blank\" method=\"get\">" + licontent2 +hiddeninput2+"</form>";
   
    var opts2 = { width: 300 };  
       
    var  infoWindow2 = new BMap.InfoWindow(content2, opts2);  
    marker2.openInfoWindow(infoWindow2);  
    marker2.addEventListener('click',function(){
        marker2.openInfoWindow(infoWindow2);
    });  
*/


    
     
    function gotobaidu(type)  
    {  
        if($.trim($("input[name=origin]").val())=="")  
        {  
            alert("请输入起点！");  
            return;  
        }else{  
            if(type==1)  
            {  
                $("input[name=mode]").val("transit");  
                $("#gotobaiduform")[0].submit();  
            }else if(type==2)  
            {      
                $("input[name=mode]").val("driving");          
                $("#gotobaiduform")[0].submit();  
            }  
        }  
    }    
</script>
<?php echo $footer;?>

